#ifndef _MATHBASE_H_
#define _MATHBASE_H_

#include "constants.h"

namespace visualization
{

inline bool EQZero(double val)
{
	return val<TOLERANCE && val>-TOLERANCE;
}

inline double Determinant3x3(const double c1[3], 
                             const double c2[3], 
                             const double c3[3])
{
  return c1[0]*c2[1]*c3[2] + c2[0]*c3[1]*c1[2] + c3[0]*c1[1]*c2[2] -
         c1[0]*c3[1]*c2[2] - c2[0]*c1[1]*c3[2] - c3[0]*c2[1]*c1[2];
}

inline double Determinant3x3(double a1, double a2, double a3, 
                             double b1, double b2, double b3, 
                             double c1, double c2, double c3)
{
    return a1*b2*c3 + a2*b3*c1 + a3*b1*c2 -
         a1*b3*c2 - a2*b1*c3 - a3*b2*c1;
}

}

#endif

